package io.demo.message.util;

import io.demo.message.domain.Address;
import java.util.function.Supplier;
import org.apache.commons.lang3.RandomUtils;

class RandomAddressSupplier implements Supplier<Address> {

  private RandomStringBuilder randomStringBuilder;

  RandomAddressSupplier() {
    this.randomStringBuilder = RandomStringBuilder.newBuilder()
        .useWhitespace()
        .useUpperCase()
        .useLowerCase();
  }

  @Override
  public Address get() {
    return Address.builder()
        .id(RandomUtils.nextLong())
        .city(TestingModels.city())
        .country(TestingModels.country())
        .street(randomStringBuilder.build(10, 30))
        .zipCode(randomStringBuilder.build(6))
        .addressType(TestingModels.addressType())
        .build();
  }
}
